home *** CD-ROM | disk | FTP | other *** search
- /* putenv.c --- BIBLE pp. 90-91 */
- #include <stdio.h>
- #include <stdlib.h>
- main(int argc, char **argv)
- {
- char *value;
- if(argc < 2)
- {
- printf("Usage : %s <env_var_def.>\n", argv[0]);
- exit(0);
- }
- /* Add new definition to the environment table */
- strupr(argv[1]);
- if (putenv(argv[1]) == -1)
- {
- printf("Error adding the definition: %s\n",
- argv[1]);
- }
- else
- {
- printf("Added to environment table : %s\n", argv[1]);
- printf("This definition will be gone once the program "
- "exits.\n");
- }
- }